package network;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class TcpDictServer extends TcpEchoServer{
    Map<String,String> map=new HashMap<>();
    public TcpDictServer(int port) throws IOException {
        super(port);
        map.put("hello"," 你好");
        map.put("computer","电脑");
        map.put("charge","充电");
        map.put("book","书");
        map.put("dog","小狗");
        map.put("cup","小猫");
    }
    @Override
    public String process(String request){
        return map.getOrDefault(request,"没找到该单词");
    }

    public static void main(String[] args) throws IOException {
        TcpDictServer server=new TcpDictServer(10009);
        server.start();
    }
}
